﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.AddIn.Contract;
using System.AddIn.Pipeline;

namespace RootfusAddinContracts
{
    [AddInContract]
    public interface IRootfusSurfaceItemContract : IContract
    {
        /// Return the WPF UIElement for this addin that is displayed when settings aren't selected.
        System.AddIn.Contract.INativeHandleContract SurfaceUI
        {
            get;
        }

        /// Return the WPF UIElement for this addin that is displayed when the user wants to do settings.
        /// Return null if there are no settings.
        System.AddIn.Contract.INativeHandleContract ConfigUI
        {
            get;
        }

        /// <summary>
        /// Called when the user has finished interacting with the config UI.
        /// </summary>
        void ConfigDone();

        /// <summary>
        /// Return true if there is a settings UI - allows inspection without wasting memory by creating
        /// the thing.
        /// </summary>
        bool HasSettingsUI
        {
            get;
        }

        /// <summary>
        /// Returns true if the user is allowed to resize the surface item. The surface resize box
        /// won't be displayed if this is false.
        /// </summary>
        bool SurfaceUIResizeAllowed
        {
            get;
        }

        /// <summary>
        /// Request a new sisze change.
        /// </summary>
        /// <param name="delta_width"></param>
        /// <param name="delta_height"></param>
        void RequestResize(double width, double height);

        /// Returns a list of the input and output pins
        IListContract<IPinDefinitionContract> InputPins
        {
            get;
        }

        /// <summary>
        /// Returns a list of all pins that this guy is generating.
        /// </summary>
        IListContract<string> OutputPinNames
        {
            get;
        }

        /// Called by the framework when one of the inputs may have changed!
        void Update();

        /// <summary>
        ///  Save the callback to be used later.
        /// </summary>
        /// <param name="callback"></param>
        void SetCallback(ISICallbackContract callback);

        /// <summary>
        /// Return the data associated with a pin as a root object. Or null. :-)
        /// </summary>
        /// <param name="pin"></param>
        /// <returns></returns>
        ROOTObjectSpec GetPinDataAsROOTObject(string pinName);

        /// <summary>
        /// Called when the config xml is changing. Update yourself! :-)
        /// </summary>
        /// <param name="xml_config"></param>
        void SetConfigXML(string xml_config);
    }
}
